0fce5fba6fbe920545eab64224bfb5e2ef6f94b7,src/edu/stanford/nlp/pipeline/XMLOutputter.java,XMLOutputter,addCorefMention,#Element#String#List#CorefChain.CorefMention#boolean#,328
Before Change
Integer.toString(mention.headIndex));
if (sentences != null) {
String text = StringUtils.joinWords(sentences.get(mention.sentNum - 1).get(CoreAnnotations.TokensAnnotation.class),
" ", mention.startIndex - 1, mention.endIndex -1);
setSingleElement(mentionElem, "text", curNS, text);
}
chainElem.appendChild(mentionElem);
After Change
setSingleElement(mentionElem, "head", curNS,
Integer.toString(mention.headIndex));
String text = mention.mentionSpan;
setSingleElement(mentionElem, "text", curNS, text);
if (sentences != null) {
List<CoreLabel> tokens = sentences.get(mention.sentNum - 1).get(CoreAnnotations.TokensAnnotation.class);
int contextStart = Math.max(mention.startIndex - 1 - 5, 0);
int contextEnd = Math.min(mention.endIndex - 1 + 5, tokens.size());
String context = StringUtils.joinWords(tokens, " ", contextStart, mention.startIndex - 1)
+ "[[" + mention.mentionSpan + "]]" + StringUtils.joinWords(tokens, " ", mention.endIndex - 1, contextEnd);
setSingleElement(mentionElem, "context", curNS, context);
}
chainElem.appendChild(mentionElem);